#include <stdio.h>
#include "scene.h"

/* Construct scene based on scene.h 
 * Should be replaced with reading parametes from file.
 */
void construct(scene *myScene, sphere *move){

		
        int i=0;

        /* Set scene size */
        myScene->width  = WIDTH;
        myScene->height = HEIGHT;

        /* Populate all materials */
        for (i=0; i < MATERIALS; i++){
                myScene->materials[i].diffuse.red        = myMaterials[i][0];
                myScene->materials[i].diffuse.green      = myMaterials[i][1];
                myScene->materials[i].diffuse.blue       = myMaterials[i][2];
                
                myScene->materials[i].ref		         = myMaterials[i][3];
                
                myScene->materials[i].specular.red       = myMaterials[i][4];
                myScene->materials[i].specular.green     = myMaterials[i][5];
                myScene->materials[i].specular.blue      = myMaterials[i][6];
                
                myScene->materials[i].power              = myMaterials[i][7];
        }
        /* Populate all spheres */
        for (i=0; i < SPHERES; i++){
                myScene->spheres[i].pos.x        = mySpheres[i][0];
                myScene->spheres[i].pos.y        = mySpheres[i][1];
                myScene->spheres[i].pos.z        = mySpheres[i][2];
                myScene->spheres[i].r		     = mySpheres[i][3];
                myScene->spheres[i].mat		     = (int)mySpheres[i][4];
                //printf("Sphere %d, position: %f  %f  %f \n",i,myScene->spheres[i].pos.x,myScene->spheres[i].pos.y,myScene->spheres[i].pos.z);
        }
        //printf("Sphere materials in succession: blue, red, green \n");

        myScene->spheres[SPHERES-1].pos.x	= move->pos.x;
        myScene->spheres[SPHERES-1].pos.y	= move->pos.y;
        myScene->spheres[SPHERES-1].pos.z	= move->pos.z;
        myScene->spheres[SPHERES-1].r		= move->r;
        myScene->spheres[SPHERES-1].mat		= move->mat;

        /* Populate all lights */
        for (i=0; i < LIGHTS; i++){
                myScene->lights[i].pos.x                = myLights[i][0];
                myScene->lights[i].pos.y                = myLights[i][1];
                myScene->lights[i].pos.z                = myLights[i][2];
                myScene->lights[i].intensity.red        = myLights[i][3];
                myScene->lights[i].intensity.green      = myLights[i][4];
                myScene->lights[i].intensity.blue       = myLights[i][5];
        }
        
}

